package thread;
//通过饿汉式建立单例模式
class Singleton{
    private static Singleton instence=new Singleton();
    public static Singleton getinstence(){
          return instence;
    }
    private Singleton(){

    }
    private Singleton(int num){

    }

}
public class Demo27 {
    public static void main(String[] args) throws InterruptedException{
          Singleton singleton=Singleton.getinstence();
          Singleton singleton1=Singleton.getinstence();
        System.out.println(singleton==singleton1);
    }
}
